You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

22 lines
680 B

import { defineWrappedResponseHandler } from "#server/utils/handler";
import { R } from "#server/utils/response";
import { requireAdmin } from "#server/utils/admin-guard";
import { getAgentBySlugAny, getAgentTools } from "#server/service/agent/agent";
export default defineWrappedResponseHandler(async (event) => {
await requireAdmin(event);
const agentSlug = getRouterParam(event, "agentSlug");
if (!agentSlug) {
return R.error("参数无效", null);
}
const agent = await getAgentBySlugAny(agentSlug);
if (!agent) {
return R.error("agent 不存在", null);
}
const tools = await getAgentTools(agent.id);
return R.success({ ...agent, tools });
});